<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
${aier_doctype}
<html <s:property value="aier-html-xmlns" escape="false"/>>
<head>
<meta http-equiv="Content-Type" content="${aier_content_type}" />
<meta name="keywords" content="${aier_keyworks}" />
<meta name="description" content="${aier_description}" />
<title>${aier_title}</title>
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}ui.css" />
<link rel="Stylesheet" href="${aier_css_url}jq/jq.css" />
<link rel="Stylesheet" href="${aier_css_url}jq/multiselect.css" />
<link rel="stylesheet" href="${aier_css_url}jc/chosen.css" >
<link rel="stylesheet" href="${aier_css_url}social/module/jq-msg.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/reset.css" />
<link rel="stylesheet" href="${aier_css_url}social/school/common.css" />
<link rel="stylesheet" href="${aier_css_url}social/school/smanage.css" />

<script type="text/javascript" src="${aier_js_url}j.js"></script>
<script type="text/javascript" src="${aier_js_url}b.js"></script>
<script type="text/javascript" src="${aier_js_url}${aier_jqui_js}ui.js"></script>
<script type="text/javascript" src="${aier_js_url}97/WdatePicker.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/msg.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/cn.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/jq.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/ja.js"></script>
<script type="text/javascript" src="${aier_js_url}jc/cj.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/block.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/multiselect.js"></script>
<script type="text/javascript" src="${aier_js_url}social/school/stinvite.js"></script>
<script type="text/javascript">
	var global_suffix = "${aier_suffix}", global_url = "${aier_url}", global_uri = "${aier_uri}", global_urijs = "${aier_urijs}", 
	global_sid = "${sid}",global_tid = "${tid}";
</script>
</head>
<!-- 教师邀请页面 -->
<body>
	<!-- 顶栏 -->
	<s:action name="userhomecomm_homeHead" namespace="/user"
		executeResult="true"></s:action>

	<!-- 正文 -->
	<div id="hfContent" class="ar-content">
		<div class="content-main">
			<!-- 学校名称栏 -->
			<s:action name="scomm_schoolMTitle" namespace="/school" executeResult="true"></s:action>
			<div class="main-content wrap-bg clearfix">
				<!-- 左侧栏 -->
				<s:action name="scomm_schoolMLeft" namespace="/school" executeResult="true"></s:action>
				<!-- 右侧内容 -->
				<div class="ae-right">
					<div class="right-main">
						<div class="right-main-top">
							<div class="binfo-title">
								<span>教师邀请</span>
							</div>
							<div class="right-line"></div>
						</div>
						<div class="right-main-c">
							<div class="info-tab01">
								<table>

									<tr>
										<th class="gray6">姓名：</th>
										<td><input type="text" class="PY-input" id="tname">
										</td>
									</tr>
									<tr>
										<th class="gray6">职务：</th>
										<td><select id="upSgrade" class="chosen">
												<option value="-1">请选择</option>
												<c:forEach var="sg" items="${schoolGradeList }">
													<option value="${sg.gid}">${sg.name}</option>
												</c:forEach>
										</select>
										</td>
									</tr>
									<tr>
										<th class="gray6">手机号：</th>
										<td><input type="text" class="PY-input" id="phone">
										</td>
									</tr>
									<tr>
										<th></th>
										<td>
											<a id="stinvBtn" href="javascript:;" onclick="addInvite()"
											class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only fr"
											role="button" aria-disabled="false"><span
												class="ui-button-text">邀请</span> </a>
										</td>
									</tr>
								</table>
							</div>
							<div class="right-main-down">
								<div class="binfo-title">
									<h6>邀请记录</h6>
								</div>
								<div class="down-line"></div>
								
								<div class="down-inre">
								<table id="stInviteInfo"></table>
								<div id="stInvitePage"></div>
								</div>
							</div>
						</div>

					</div>
				</div>

			</div>

		</div>
		<!-- footer copyright -->
		<s:action name="userhomecomm_homeFooter" namespace="/user" executeResult="true"></s:action>
		<!-- /footer copyright -->
	</div>
</body>
<script type="text/javascript">
	$(".chosen").chosen();
	
	function addInvite() {
		var tname = $("#tname").val();
		var phone = $("#phone").val();
		if(tname.trim()==""){
			$().message("请输入教师姓名");
			return false;
		}
		if(phone.trim()==""){
			$().message("请输入手机号");
			return false;
		}
		var phonevalue = check_phone(phone);
		if(phonevalue!="true"){
			$().message("号码"+phone+"格式有误!");
			return false;
		}
		
		var funadd2 = function(data){
			if (data.s == 1) {
				$().message("发送邀请成功!");
				$("#stInviteInfo").trigger("reloadGrid");
			} else {
				$().message(data.error_info);
			}
		};
		exeAjax(ajaxUrl("${aier_url}${aier_urijs}schooltinvite_addTeacherInvite${aier_suffix}"), funadd2, {
		"tname":tname,
		"phone":phone,
		"gid":$('#upSgrade  option:selected').val(),
		"sid":global_sid,
		"tid":global_tid});
		
	};





	function check_phone(phone){
		var regu = /^[1]([3-8][0-9]{1}|59|58|88|89)[0-9]{8}$/;
		var isphone = regu.exec(phone);
		if(isphone!=null){
			return "true";
		}else{
			return "fasle";					
		}			
	}
		
</script>
</html>